| 1. | Assertion statements compile only when 仅当定义了 |
| 2. | You can add assertion statements as the pre - or post - conditions of a method 可以将断言语句作为方法的前置条件或后置条件来添加。 |
| 3. | An assertion statement specifies a condition that you expect to hold true at some particular point in your program 断言语句指定在程序的某些特定点应为真的条件。 |
| 4. | If you assume that an argument is not null , for example , use an assertion statement to check for that assumption 例如,如果假定某个参数不为null ,请使用一条断言语句检查该假定。 |
| 5. | Be especially careful about using function calls in assertion statements , because evaluating a function can have unexpected side effects 在断言语句中使用函数调用时应特别小心,因为计算函数可能会有意外的副作用。 |
| 6. | When you run this code under the debugger , the assertion statement is evaluated , but in the release version , the comparison is not made , so there is no additional overhead 当在调试器下运行该代码时,将计算断言语句,但是在发布版本中,将不进行该比较,因此没有额外的系统开销。 |
| 7. | Discusses assertion statements , how they work , the benefits of using them catching logic errors , checking results of an operation , and testing error conditions , their interaction with 讨论断言语句,包括它们的工作方式,使用它们的好处(捕捉逻辑错误、检查操作的结果和测试错误情况) ,它们与 |
| 8. | Therefore , assertion statements have zero overhead in your final release program ; you can use them liberally in your code without affecting the performance of your release version and without having to use 因此,断言语句在最终发布程序中系统开销为零;可以在代码中大量使用断言语句,而不影响“ release ”版本的性能,并且不必使用 |